//
//  UILable+Extension.swift
//  sinaWeibo
//
//  Created by liii on 16/7/21.
//  Copyright © 2016年 liii. All rights reserved.
//

import UIKit

extension UILabel {
    
    // 工厂方法(类方法)
    // 注意: 如果给函数设置了"默认参数值", 在调用的时候可以不写, 会按默认值赋值
    class func labelWithText(text: String, fontSize: CGFloat, textColor: UIColor, alpha: CGFloat = 1, alignment: NSTextAlignment = .Center) -> UILabel {
        let l = UILabel()
        l.text = text
        l.textColor = textColor
        l.textAlignment = alignment
        l.font = UIFont.systemFontOfSize(fontSize)
        l.numberOfLines = 0
        l.alpha = alpha
        l.sizeToFit()
        return l
    }
    
}
